//
//  statusForwardCell.swift
//  MicroBlog
//
//  Created by QT on 15/8/3.
//  Copyright © 2015年 綦敦涛. All rights reserved.
//

import UIKit

class statusForwardCell: statusCell {
    // 重写属性，子类不会修改父类内容，只需设置自己内容即可
    override var Status:status?{
    didSet{
        let name = Status?.retweeted_status?.User?.name ?? ""
        let text = Status?.retweeted_status?.text ?? ""

        forwardLab.text = "@" + name + ":" + text
    }
    }
    
    override func prepareUI() {
        super.prepareUI()
        
        contentView.insertSubview(backBtn, belowSubview: pictureView)
        contentView.insertSubview(forwardLab, aboveSubview: backBtn)
        
        backBtn.backgroundColor = UIColor.redColor()
        print(backBtn)
        
        // 添加约束
        backBtn.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: content, size: nil, offset: CGPoint(x: -8, y: 8))
        backBtn.ff_AlignVertical(type: ff_AlignType.TopRight, referView: bottomView, size: nil)
        // 转发内容
        forwardLab.ff_AlignInner(type: ff_AlignType.TopLeft, referView: backBtn, size: nil, offset: CGPoint(x: 8, y: 8))
        
        // 图片约束
        
        let cons = pictureView.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: forwardLab, size: CGSize(width: 290, height: 290), offset: CGPoint(x: 0, y: 8))
        
        widthConstraint = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Width)
        heightConstraint = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Height)

        
    }

    // MARK: - 懒加载
    private lazy var forwardLab :UILabel = {
        let lab = UILabel(color: UIColor.lightGrayColor(), fontSize: 14)
        lab.numberOfLines = 0
        lab.preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 16
        return lab
    }()
    
    private lazy var backBtn :UIButton = {
        let btn = UIButton()
        btn.backgroundColor = UIColor.redColor()
        return btn
    }()
}
